package org.dizem.groupon.dao.impl;

import org.dizem.groupon.dao.LinkDAO;
import org.dizem.groupon.model.domain.LinkEntity;
import org.hibernate.criterion.DetachedCriteria;

import java.util.List;

/**
 * User: dizem
 * Time: 11-7-19 上午11:32
 */
public class LinkDAOImpl extends DAOImplSupport<LinkEntity> implements LinkDAO {

	public LinkEntity getById(int id) {
		return (LinkEntity) getHibernateTemplate().get(LinkEntity.class, id);
	}

	public List<LinkEntity> loadAll() {
		return getHibernateTemplate().loadAll(LinkEntity.class);
	}

	public List<LinkEntity> load(int firstResult, int maxResult) {
		return getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(LinkEntity.class), firstResult, maxResult);
	}

}
